package com.qf.controller;

import com.qf.entity.R;
import com.qf.entity.User;
import com.qf.framwork.annotation.RequestParams;
import com.qf.framwork.base.BaseServlet;
import com.qf.service.IUserService;
import com.qf.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zewei
 * @create_time 2023/2/22
 */
@WebServlet("/UserServlet")
public class UserServlet extends BaseServlet {
    private IUserService userService =new UserServiceImpl();
    public R delete (@RequestParams("id") Integer id){
        int result=userService.delete(id);
        return new R().setCode(result);
    }

    public R update(User user){

        return new R().setCode(userService.update(user));

    }

    public R queryList(){

        return new R().setData(userService.queryList());

    }

    public R insert(User user){

        return new R().setCode(userService.insert(user));

    }

}
